const base = require("./base");

module.exports = class extends base {
    async _initialize() {
        await super.isWxaAuth();
    }

    async index() {
        const { page = 1 } = this.query;
        const wxaId = this.state.wxa.id;

        const wxaplugins = await this.model("wxaplugins")
            .query(qb => {
                qb.where("wxa_id", wxaId);
                qb.orderBy("id", "desc");
            })
            .fetchPage({
                page: page
            });
        this.success(wxaplugins);
    }
};
